<template>
  <!-- <router-link to="/Login">登入</router-link> -->
  <div class="person_conter">
    <div class="person_username">
      <div class="smllbox">
        <van-image round width="71px" height="71px" :src="userInfoStore.userInfo.headImg" />
        <div class="name_titlie">
          <div class="name">{{ userInfoStore.userInfo.name }}</div>
          <div style="font-size: 14px; color: #fff; margin-left: 3px; line-height: 25px;">普通用户</div>
        </div>

      </div>
      <div class="reftimg">
        <i class="ewm"><img
            src="https://yanxuan-static.nosdn.127.net/hxm/yanxuan-mall-wap/assets/img/ucenter-11eb865ad061b2dd08d2ec54d87461d6.png"
            alt=""></i>
        <img class="vipimg" src="../../assets/images/1.png" alt="">
      </div>
    </div>
    <div class="m-myAsset">
      <div class="zichan">
        <h2>我的资产</h2>
      </div>
      <div class="assetList">
        <div class="assetItem">
          <p class="assetCount"><span class="unit">¥</span>
            <van-badge dot>
              <span class="value">0</span>
            </van-badge>
          </p>

          <p class="assetName">余额</p>

        </div>
        <div class="assetItem">
          <p class="assetCount"><span class="unit">¥</span>
            <span class="value">0</span>
          </p>
          <p class="assetName">红包</p>
        </div>
        <div class="assetItem">
          <p class="assetCount"><span class="unit">¥</span>
            <span class="value">0</span>
          </p>
          <p class="assetName">优惠券</p>
        </div>
        <div class="assetItem">
          <p class="assetCount"><span class="unit">¥</span>
            <span class="value">0</span>
          </p>
          <p class="assetName">积分</p>
        </div>
        <div class="assetItem">
          <p class="assetCount"><span class="unit">¥</span>
            <span class="value">0</span>
          </p>
          <p class="assetName">礼品卡</p>
        </div>
      </div>
      <div class="monthcard">
        <div class="monthcard_box">
          <img class="monthcard_img" src="../../assets/images/2.png" alt="">
          <!-- <button class="monthcard_but">现时开通</button> -->
          <van-button class="monthcard_but" type="warning">限时开通</van-button>
        </div>
      </div>
    </div>

    <div class="g-row">
      <div class="m-uMenu">
        <ul class="list">
          <li class="item">
            <a class="m-uMenuItem" href="">
              <i class="img"></i>
              <span class=" text" style="font-size: 12px;">我的订单</span>
            </a>
          </li>
          <li class="item">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: -26px 25px;"></i>
              <span class=" text" style="font-size: 12px;">帐号管理</span>
            </a>
          </li>
          <li class="item" style="   border-right: 0px ">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: 19.5px 1px;"></i>
              <span class=" text" style="font-size: 12px;">我的手机号</span>
            </a>
          </li>
          <li class="item">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: 43px -77px;"></i>
              <span class=" text" style="font-size: 12px;">周六一起拼</span>
            </a>
          </li>
          <li class="item">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: 108px -62px;"></i>
              <span class=" text" style="font-size: 12px;">售后服务</span>
            </a>
          </li>
          <li class="item" style="   border-right: 0px ">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: 44px 0px;"></i>
              <span class=" text" style="font-size: 12px;">邀请返利</span>
            </a>

          </li>
          <li class="item">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: 109px -87px;"></i>
              <span class=" text" style="font-size: 12px;">优选购</span>
            </a>
          </li>
          <li class="item">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: 44px -51px;"></i>
              <span class=" text" style="font-size: 12px;">积分中心</span>
            </a>

          </li>
          <li class="item" style="   border-right: 0px ">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: -51px -112px;"></i>
              <span class=" text" style="font-size: 12px;">会员俱乐部</span>
            </a>
          </li>
          <li class="item">

            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: -25px -62px;"></i>
              <span class=" text" style="font-size: 12px;">地址管理</span>
            </a>
          </li>
          <li class="item">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: 0 -114px;"></i>
              <span class=" text" style="font-size: 12px;">安全支付</span>
            </a>
          </li>
          <li class="item" style="   border-right: 0px ">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: -65px -138px;"></i>
              <span class=" text" style="font-size: 12px;">帮助与服务</span>
            </a>

          </li>
          <li class="item" style="   border-bottom: 0px ">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: -91px -166px;"></i>
              <span class=" text" style="font-size: 12px;">意见反馈</span>
            </a>
          </li>
          <li class="item" style="   border-bottom: 0px ">
            <a class="m-uMenuItem" href="">
              <i class="img" style="  background-position: -40px 0;"></i>
              <span class=" text" style="font-size: 12px;">我的竞拍</span>
            </a>
          </li>
        </ul>
      </div>
    </div>

    <div class="butto" @click="ExitLogin">
      退出登录
    </div>
    <div class="but">
      <!-- 底部占位 -->
    </div>
    
  </div>
  <BackTopTo></BackTopTo>
</template>

<script setup lang="ts">
import { onMounted } from 'vue';
import { ref } from 'vue';
import { useUserInfoStore } from '../../stores/userInfo';
import { useRouter } from 'vue-router';
import { getToken } from '../../utils/token-utils';
const router = useRouter()


const userInfoStore = useUserInfoStore()

onMounted(() => {
  if (getToken()) {
    getuserinfo()

  }
})
const getuserinfo = async () => {
  try {
    let res = await userInfoStore.getInfos()
  } catch (error) {
    console.log(error);

  }
}
const ExitLogin = async () => {
  try {
    let res = await userInfoStore.reset()
    
    router.push("/Home")
    
  } catch (error) {
    console.log(error);

  }
}
</script>

<style scoped lang="less">
.person_conter {
  width: 100%;
  min-height: 100%;
  background: #eee;

  .person_username {
    width: 100%;
    height: 135px;
    background-image: url(https://yanxuan.nosdn.127.net/5905098f74e04c39fa5e76ebb9ff591b.png);
    background-size: 100% 20%;
    background-attachment: fixed;
    position: relative;

    .smllbox {

      position: absolute;
      top: 30px;
      left: 20px;
      display: flex;

      .name_titlie {
        display: flex;
        flex-direction: column;
        margin-left: 10px;

        .name {
          margin-top: 15px;
          font-size: 18px;
          color: #fff;
        }
      }
    }

    .reftimg {
      width: 120px;
      height: 94px;
      position: absolute;
      right: 0;
      top: 30px;

      .ewm {
        width: 32px;
        height: 32px;
        overflow: hidden;
        display: block;
        position: absolute;
        right: 10px;
        top: 0;

        // position: absolute;
        // width: 32px;
        // height: 32px;
        // background-image: url(https://yanxuan-static.nosdn.127.net/hxm/yanxuan-mall-wap/assets/img/ucenter-11eb865ad061b2dd08d2ec54d87461d6.png);
        // background-size: 32px 32px;
        // display: inline-block;
        // vertical-align: middle;
        img {
          width: 180px;
          height: 140px;
        }
      }

      .vipimg {
        position: absolute;
        right: 0px;
        bottom: 10px;
      }
    }

  }

  .m-myAsset {
    width: 100%;
    height: 200px;
    background: #fff;

    .zichan {
      padding-left: 15px;

      h2 {
        padding: 0;
        margin: 0;
        font-size: 14px;
        height: 50px;
        line-height: 50px;
        width: 100%;
        border-bottom: 1px solid #bebbbb;
      }
    }


    .assetList {
      display: flex;
      justify-content: space-between;

      .assetItem {
        height: 80px;
        font-size: 12px;
        text-align: center;

        .assetCount {
          font-size: 14px;
          font-weight: bold;
        }

        .assetName {
          margin: 0 20px;
        }
      }
    }

    .monthcard {
      padding: 0 10px;
      width: 355px;
      height: 45px;

      .monthcard_box {
        width: 100%;
        height: 100%;
        background: #fff6f4;
        border-radius: 10px;
        border: 1px solid #d6a9a9;
        position: relative;

        .monthcard_img {
          position: absolute;
          top: 8px;
          left: 10px;
        }

        .monthcard_but {
          border-radius: 10px;
          height: 25px;
          font-size: 12px;
          line-height: 25px;
          color: #fff;
          background: #dd1a21;
          position: absolute;
          top: 10px;
          right: 10px;
        }
      }
    }
  }

  .g-row {
    width: 100%;
    height: 454px;
    background: #fff;
    margin-top: 10px;

    .m-uMenu {
      .list {
        display: flex;
        flex-wrap: wrap;

        .item {
          width: 123.98px;
          height: 90px;
          border-right: 1px solid #ccc6c6;
          border-bottom: 1px solid #ccc6c6;
          position: relative;

          .m-uMenuItem {
            position: absolute;
            left: 28px;
            top: 20px;
            align-items: center;
            width: 70px;
            height: 50px;
            display: flex;
            flex-direction: column;
            color: #5c5858;

            .text {
              margin-top: 10px;
            }

            .img {
              width: 25px;
              height: 25px;
              display: inline-block;
              background-image: url(https://yanxuan-static.nosdn.127.net/hxm/yanxuan-mall-wap/assets/img/ucenter-11eb865ad061b2dd08d2ec54d87461d6.png);
              background-position: 41px -26px;
              background-size: 160.5px 139px;
            }
          }
        }
      }
    }
  }
}

.butto {
  width: 100%;
  height: 48px;
  text-align: center;
  margin-top: 20px;
  background: #fff;
  border-radius: 10px;
  line-height: 48px;
  margin-bottom: 10px;
  font-size: 14px;
}

.but {
  width: 100%;
  height: 48px;
}
</style>